package online.hxstart.code.concurrent.chapter05;

import java.util.List;
import java.util.concurrent.TimeoutException;

/**
 * @author huxing
 * @date 19-4-24 星期三 下午2:34
 * @describe
 */
public interface Lock {

  /**
   * 方法永远被阻塞 除非获取到了锁 与synchronized
   */
  void lock() throws InterruptedException;

  /**
   *
   */
  void lock(long mills) throws InterruptedException, TimeoutException;

  boolean tryLock() throws InterruptedException;

  /**
   * 释放锁
   */
  void unlock();

  /**
   * 用于获取当期那
   * @return
   */
  List<Thread> getBlockedThreads();
}
